const {
	Dubbo
} = require('dubbo2.js');
const process = require('child_process');
module.exports = app => {
	const dubbo = new Dubbo({
		application: app.config.dubbo.application,
		register: app.config.dubbo.register,
		dubboVersion: app.config.dubbo.dubboVersion,
		dubboInvokeTimeout: 60,
		interfaces: [
			'com.bxw.qianfw.admin.service.UserService',
			'com.bxw.qianfw.admin.service.LogLoginService',
			'com.bxw.qianfw.admin.service.LogOperationService',
			'com.bxw.qianfw.admin.service.NoticeService',
			'com.bxw.qianfw.admin.service.AdvertListService',
			'com.bxw.qianfw.admin.service.ArticleService',
			'com.bxw.qianfw.admin.service.EvaluatSubjectService',
			'com.bxw.qianfw.admin.service.EvaluatTypeService',
			'com.bxw.qianfw.admin.service.FriendsLinkService',
			'com.bxw.qianfw.admin.service.WebContentService',
			'com.bxw.qianfw.admin.service.WebFloatLayerService',
			'com.bxw.qianfw.customer.service.backstageService.AdminLoanApplyService',
			'com.bxw.qianfw.customer.service.LoanInfoService',
			'com.bxw.qianfw.customer.service.AfterLoanCheckService',
			'com.bxw.qianfw.customer.service.CapitalRecordService',
			'com.bxw.qianfw.customer.service.BankCardService',
			'com.bxw.qianfw.customer.service.MyAccountService',
			'com.bxw.qianfw.customer.admin.service.AdminUserService',
			'com.bxw.qianfw.admin.service.RepaymentSetService',
			'com.bxw.qianfw.admin.service.SmsTemplateService',
			'com.bxw.qianfw.admin.service.SmsInterfaceConfigService',
			'com.bxw.qianfw.admin.service.ProtocolService',
			'com.bxw.qianfw.admin.service.LinkageParamService',
			'com.bxw.qianfw.admin.service.RoleService',
			'com.bxw.qianfw.admin.service.AdminSysUserService',
			'com.bxw.qianfw.admin.service.LoanCostSetService',
			'com.bxw.qianfw.admin.service.WithdrawSetService',
			'com.bxw.qianfw.admin.service.RechargeSetService',
			'com.bxw.qianfw.customer.admin.service.SmsSendRecordService',
			'com.bxw.qianfw.customer.service.CollectMoneyService',
			'com.bxw.qianfw.customer.service.InvestmentService',
			'com.bxw.qianfw.customer.service.WeiXinMpMenuService',
			'com.bxw.qianfw.admin.service.ComProblemService',
			'com.bxw.qianfw.admin.service.ComProblemTypeService',
			'com.bxw.qianfw.admin.service.OperatContentService',
			'com.bxw.qianfw.admin.service.OperatManageService',
			'com.bxw.qianfw.customer.statistical.service.StatisticalService',
			'com.bxw.qianfw.customer.statistical.service.InvestAmountStatisticsService',
			'com.bxw.qianfw.customer.statistical.service.InvestNewInvestorStatisticsService',
			'com.bxw.qianfw.customer.statistical.service.InvestPersonStatisticsService',
			'com.bxw.qianfw.customer.statistical.service.InvestPureIncomeStatisticsService',
			'com.bxw.qianfw.customer.statistical.service.InvestUserRegistStatisticsService',
			'com.bxw.qianfw.customer.statistical.service.InvestWaitEarnStatisticsService',
			'com.bxw.qianfw.customer.statistical.service.BorrowApplyConvertRateStatisticsService',
			'com.bxw.qianfw.customer.statistical.service.BorrowPassStatisticsService',
			'com.bxw.qianfw.customer.apush.service.ApushService',
			'com.bxw.qianfw.customer.service.ManDaoDataSyncService',
			'com.bxw.qianfw.customer.statistical.service.InvestAmountRankService',
			'com.bxw.qianfw.customer.statistical.service.InvestHasEarnRankService',
			'com.bxw.qianfw.customer.statistical.service.BorrowLoanMoneyRankService',
			'com.bxw.qianfw.customer.statistical.service.InvestRemainRankService',
			'com.bxw.qianfw.customer.statistical.service.BorrowReturnedRankService',
		]
	});

	app.beforeStart(async() => {
		app.dubbo = dubbo;
//		setTimeout(function() {
//			process.exec('npm stop', function(error, stdout, stderr) {
//				if(error !== null) {
//					console.log('exec error: ' + error);
//				}
//			});
//		}, 10000);
	});

};